I have a string 'completeString' that I've created by concatenating the contents of several "Object Text"'s together by using the richTextWithOLE since some of these objects contain OLE tables. Once I've created this string I want to copy the concatenated string to an attribute that I've created. How do I make this assignment? I know for layout DXL 'displayRich completeString' would work but when I assign to an attribute I'm having problems viewing the content. |
Re: How to assign a richText string to an attribute Regards, Peter |
Re: How to assign a richText string to an attribute Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: How to assign a richText string to an attribute Mathias Mamsch - Fri Nov 19 19:05:37 EST 2010 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: How to assign a richText string to an attribute Mathias Mamsch - Fri Nov 19 19:05:37 EST 2010 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
I believe I'm following the steps cited in this post but I'm not getting the expected results. +-----+--------------------------+ | I | want to | +-----+--------------------------+ | be | rendered as fixed-width | +-----+--------------------------+
void showRawObjectText(Object o) {
Module m = (Module current);
string objText = richTextNoOle(o."Object Text");
print "Raw Object Text is:\n" objText "\n"
}
void setObjectTextToFixedWidthFontString(Object o,
string myFixedWidthLines[]) {
string fixedWidthRtfPrefix = //-
"{\\rtf1\\ansi\\deff0\\deflang1033\n" //-
"{\\fonttbl{\\f555\\fmodern\\fprq1 Courier New;}}\n" //-
"{\\viewkind4\\pard\\f555\n";
string fixedWidthRtfContent = "";
string fixedWidthRtfSuffix = //-
"}\n" //-
"}\n";
int i;
for (i = 0; i < sizeof(myFixedWidthLines); i++) {
fixedWidthRtfContent = fixedWidthRtfContent //-
myFixedWidthLines[i] "\\par\n";
}
o."Object Text" = richText( fixedWidthRtfPrefix //-
fixedWidthRtfContent //
fixedWidthRtfSuffix );
}
Object o = (Object current);
string myAsciiTable[] = {
" +-----+--------------------------+",
" | I | want to |",
" +-----+--------------------------+",
" | be | rendered as fixed-width |",
" +-----+--------------------------+"
}
setObjectTextToFixedWidthFontString(o, myAsciiTable);
showRawObjectText(o);
{\rtf1\ansi\deff0\deflang1033
{\fonttbl{\f555\fmodern\fprq1 Courier New;}}
{\viewkind4\pard\f555
+-----+--------------------------+\par
| I | want to |\par
+-----+--------------------------+\par
| be | rendered as fixed-width |\par
+-----+--------------------------+\par
}
}
string richTextFragment(string richString, string fontTable);
|
Re: How to assign a richText string to an attribute SystemAdmin - Fri Mar 25 12:10:26 EDT 2011
I believe I'm following the steps cited in this post but I'm not getting the expected results. +-----+--------------------------+ | I | want to | +-----+--------------------------+ | be | rendered as fixed-width | +-----+--------------------------+
void showRawObjectText(Object o) {
Module m = (Module current);
string objText = richTextNoOle(o."Object Text");
print "Raw Object Text is:\n" objText "\n"
}
void setObjectTextToFixedWidthFontString(Object o,
string myFixedWidthLines[]) {
string fixedWidthRtfPrefix = //-
"{\\rtf1\\ansi\\deff0\\deflang1033\n" //-
"{\\fonttbl{\\f555\\fmodern\\fprq1 Courier New;}}\n" //-
"{\\viewkind4\\pard\\f555\n";
string fixedWidthRtfContent = "";
string fixedWidthRtfSuffix = //-
"}\n" //-
"}\n";
int i;
for (i = 0; i < sizeof(myFixedWidthLines); i++) {
fixedWidthRtfContent = fixedWidthRtfContent //-
myFixedWidthLines[i] "\\par\n";
}
o."Object Text" = richText( fixedWidthRtfPrefix //-
fixedWidthRtfContent //
fixedWidthRtfSuffix );
}
Object o = (Object current);
string myAsciiTable[] = {
" +-----+--------------------------+",
" | I | want to |",
" +-----+--------------------------+",
" | be | rendered as fixed-width |",
" +-----+--------------------------+"
}
setObjectTextToFixedWidthFontString(o, myAsciiTable);
showRawObjectText(o);
{\rtf1\ansi\deff0\deflang1033
{\fonttbl{\f555\fmodern\fprq1 Courier New;}}
{\viewkind4\pard\f555
+-----+--------------------------+\par
| I | want to |\par
+-----+--------------------------+\par
| be | rendered as fixed-width |\par
+-----+--------------------------+\par
}
}
string richTextFragment(string richString, string fontTable);
Experimenting with your code, the following did the trick:
// ...
string fixedWidthRtfPrefix = //-
"{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\ftech Courier New;}}"
// ...
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: How to assign a richText string to an attribute Mathias Mamsch - Fri Mar 25 12:50:43 EDT 2011
Experimenting with your code, the following did the trick:
// ...
string fixedWidthRtfPrefix = //-
"{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\ftech Courier New;}}"
// ...
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
Thanks Mathias. The good news is is works. The troublesome part is why.
A font is defined by its name, a font number, and a font family, as
shown in the following example. Semicolons are used as delimites
between fonts.
{\fonttbl\f0\froman Tms Rmn;}...
A B C D
A Control word
B Font number
C Font family
D Font name
The font numbers represent the full font definitions in the group, and
vary with each document. The font families are listed below:
Control Word Font Family
------------------------------------------
\fnil Unknown or default fonts (default)
\froman Roman, proportionally spaced serif fonts
(TmsRmn, Palatino, etc.)
\fswiss Swiss, proportionally spaced sans serif fonts
(Swiss, etc.)
\fmodern Fixed-pitch serif and sans serif fonts
(Courier, Elite, Pica, etc.)
\fscript Script fonts (Cursive, etc.)
\fdecor Decorative fonts (Old English, Zapf Chancery,
etc.)
\ftech Technical, symbol, and mathematical fonts
(Symbol, etc)
If an RTF file uses a default font, the default font number is
specified with the \deff n control word, which must precede the font
table group. The RTF writer supplies the default font number used in
the creation of the document as the numeric argument. The RTF reader
then translates this number through the font table into the most
similar font available on the reader's system.
|
Re: How to assign a richText string to an attribute SystemAdmin - Fri Mar 25 17:45:58 EDT 2011
Thanks Mathias. The good news is is works. The troublesome part is why.
A font is defined by its name, a font number, and a font family, as
shown in the following example. Semicolons are used as delimites
between fonts.
{\fonttbl\f0\froman Tms Rmn;}...
A B C D
A Control word
B Font number
C Font family
D Font name
The font numbers represent the full font definitions in the group, and
vary with each document. The font families are listed below:
Control Word Font Family
------------------------------------------
\fnil Unknown or default fonts (default)
\froman Roman, proportionally spaced serif fonts
(TmsRmn, Palatino, etc.)
\fswiss Swiss, proportionally spaced sans serif fonts
(Swiss, etc.)
\fmodern Fixed-pitch serif and sans serif fonts
(Courier, Elite, Pica, etc.)
\fscript Script fonts (Cursive, etc.)
\fdecor Decorative fonts (Old English, Zapf Chancery,
etc.)
\ftech Technical, symbol, and mathematical fonts
(Symbol, etc)
If an RTF file uses a default font, the default font number is
specified with the \deff n control word, which must precede the font
table group. The RTF writer supplies the default font number used in
the creation of the document as the numeric argument. The RTF reader
then translates this number through the font table into the most
similar font available on the reader's system.
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |